/*
 * Created on Sat Jul 26 20:13:13 KST 2008
 */
package Listener;

import java.util.Properties;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;

public class Activator implements BundleActivator {
	
	private ServiceRegistration svcreg = null;
	private ServiceReference svcref = null;
	private ListenerService	ls	=	null;

  /* (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
   */
  public void start(BundleContext context) throws Exception {
	  Properties sProps = new Properties();
	  ls = new ListenerServiceImpl();
	  
	  svcreg = context.registerService("Listener.ListenerService", ls, sProps );
	  svcref = context.getServiceReference("Listener.ListenerService");
	  
	  ls = (ListenerService) context.getService(svcref);
	 
	  ls.run();
	  
  }

  /* (non-Javadoc)
   * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
   */
  public void stop(BundleContext context) throws Exception {
	  svcreg.unregister();
  }
}